package dev.ece.util.lib;

public class Rectangle {

	public float left;
	
	public float top;
	
	public float right;
	
	public float bottom;
	
	public Rectangle() {}
	
	public Rectangle(float left, float top, float right, float bottom) {
		this.set(left, top, right, bottom);
	}
	
	public void set(float left, float top, float right, float bottom) {
		this.left = left;
		this.top = top;
		this.right = right;
		this.bottom = bottom;
	}
	
	public void set(Rectangle rectangle) {
		this.set(rectangle.left, rectangle.top, rectangle.right, rectangle.bottom);
	}
	
	public Rectangle toTextureSizeRectangle(float imageWidth, float imageHeight) {
		return new Rectangle(
				this.left / imageWidth, top / imageHeight, 
				right / imageWidth, bottom / imageHeight);
	}

	public float getLeft() {
		return left;
	}

	public void setLeft(float left) {
		this.left = left;
	}

	public float getTop() {
		return top;
	}

	public void setTop(float top) {
		this.top = top;
	}

	public float getRight() {
		return right;
	}

	public void setRight(float right) {
		this.right = right;
	}

	public float getBottom() {
		return bottom;
	}

	public void setBottom(float bottom) {
		this.bottom = bottom;
	}
	
	@Override
	public String toString() {
		return String.format("left:%s,top:%s,right:%s,bottom:%s", left, top, right, bottom);
	}
	
}
